package tsinghua.smxq.mc;

import tsinghua.smxq.ui.MCImageView;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

public class MobileCityActivity extends Activity {
	/** Called when the activity is first created. */
	MCImageView weatherSearch, mapSearch, busLineSearch, stockSearch, fee,
			vegetablePriceSearch;
	ImageButton login, logout, profile;
	TextView tvUname;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		weatherSearch = (MCImageView) findViewById(R.id.main_1);
		weatherSearch.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "天气搜索", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this,
						WeatherSearchActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});
		mapSearch = (MCImageView) findViewById(R.id.main_2);
		mapSearch.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "地图搜索", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this,
						MapSearchActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});
		busLineSearch = (MCImageView) findViewById(R.id.main_3);
		busLineSearch.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "公交搜索", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this,
						BusLineSearchActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});
		vegetablePriceSearch = (MCImageView) findViewById(R.id.main_4);
		vegetablePriceSearch.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "菜价搜索", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this,
						FoodPriceRequestActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});
		stockSearch = (MCImageView) findViewById(R.id.main_5);
		stockSearch.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "股票搜索", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this,
						StockSearchActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});
		fee = (MCImageView) findViewById(R.id.main_6);
		fee.setOnClickIntent(new MCImageView.OnViewClick() {

			@Override
			public void onClick() {
				// TODO Auto-generated method stub
				Toast.makeText(MobileCityActivity.this, "水电费缴纳", 1000).show();
				Intent intent = new Intent();
				intent.setClass(MobileCityActivity.this, ReqActivity.class);
				MobileCityActivity.this.startActivity(intent);
			}
		});

		tvUname = (TextView) findViewById(R.id.tv_username);
		tvUname.setText(Session.user.getUserName());

		profile = (ImageButton) findViewById(R.id.ib_profile);
		profile.setOnClickListener(new ImageButton.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				MobileCityActivity.this.startActivity(new Intent(
						MobileCityActivity.this, ProfileActivity.class));
			}

		});
	}
}